import torch
import matplotlib.pyplot as plt

# 散度
noise = 0.2
# 分类数据格式 [x,y,label(类别值)]
# 簇类A = 0
a = torch.normal(0.5, noise, (20, 2))
a_label = torch.zeros(20, 1)
features_a = torch.concatenate((a, a_label), dim=1)
# 簇类B = 1
b = torch.normal(1.5, noise, (20, 2))
b_label = torch.ones(20, 1)
features_b = torch.concatenate((b, b_label), dim=1)
# 组合 两个分类数据 并且需要将数据的顺序完全打乱
features = torch.concatenate((features_a, features_b), dim=0)
# 生成点的随机下标
indices = torch.randperm(features.shape[0])
features = features[indices]
# 最终的输入的特征
print(features)
# 保存二分类数据
torch.save(features, "features.pth")
